#pragma once

#include <iostream>
#include <vector>
#include <ctime>
#include <string>

typedef std::string(*task)();

std::string update()
{
    return std::string("更新任务");
}

std::string upload()
{
    return std::string("上传任务");
}

std::string updown()
{
    return std::string("下载任务");
}

class taskManager
{
public:
    taskManager()
    {
        srand(time(nullptr));
    }
    ~taskManager()
    {
    }

    int taskcode()
    {
        return rand() % tasks_.size();
    }

    void Register(task t)
    {
        tasks_.push_back(t);
    }

    std::string execute(int taskcode)
    {
        return tasks_[taskcode]();
    }

private:
    std::vector<task> tasks_;
};